<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script>
			// Date对象, 转成时间戳
			var date = new Date()
			var date2 = new Date('2033-03-03')

			// 方法一: 当前时间的时间戳
			var timestamp1 = Date.now()
			console.log('timestamp1', timestamp1)

			// 将一个date对象转成时间戳
			var timestamp2 = date.getTime()
			var timestamp3 = date.valueOf()
			console.log('timestamp2', timestamp2, timestamp3)

			// 方法四
			console.log(+date)
		</script>
	</body>
</html>
